/**
 * @description 数据库连接与基本配置
 * @author 盘古他爹
 */

import * as mysql from "mysql2";
import { Sequelize } from "sequelize";
// import { Sequelize } from "sequelize-typescript"
const seqs = new Sequelize("koa001", "root", "Zhangfengyu.324", {
    // host: 'http://47.93.221.158',
    host: 'localhost',
    dialect: "mysql",
    timezone: "+08:00",
});
const database = "nxp01";
const userName = "root";
const password = "111111"
const seq = new Sequelize(database, userName, password, {
    host: 'localhost',
    dialect: 'mysql',
    timezone: "+08:00"
});


//测试连接
const test = async () => {
    try {
        await seq.authenticate();
        console.log('成功连接数据库');
    } catch (error) {
        console.error('连接失败:', error);
    }
}

// test()

export {
    seq,
    test
}